package com.yycwxt.modules.admin.dpyy;

import com.yycwxt.common.ReturnResult;
import com.yycwxt.domain.Dpyy;
import com.yycwxt.domain.Return;
import com.yycwxt.modules.admin.Return.ReturnService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Api
@RestController
@Validated
@RequestMapping("/Dpyy")
public class DpyyController {
    private  DpyyService dpyyService;
    @Autowired
    public DpyyController(DpyyService dpyyService){this.dpyyService =  dpyyService;}

    @GetMapping("/getbyzq")
    @ApiOperation("根据账期查询店铺运营")
    public List<Dpyy> getByZq(String zq){
        Map<String, Object> map = new HashMap<>();
        map.put("zq",zq);
        return dpyyService.listByMap(map);
    }

    @GetMapping("/data")
    @ApiOperation("获取数据")
    public ReturnResult getdata(int zq){
        return ReturnResult.buildSuccessResult(dpyyService.getdpyy(zq));
    }

    // 查询下载文件地址
    @GetMapping("/getDpyyUrl")
    @ApiOperation("获取店铺运营文件的URL")
    public ReturnResult getUrl(){
        return ReturnResult.buildSuccessResult(dpyyService.getDpyyUrl());
    }

}
